Skip to content

feat(spinner): add recipe and tokens#31014

Merged
thetaPC merged 30 commits intoionic-modularfrom
FW-6860
Mar 24, 2026
Merged

feat(spinner): add recipe and tokens#31014
thetaPC merged 30 commits intoionic-modularfrom
FW-6860

Conversation

@thetaPC
Copy link
Copy Markdown
Contributor

@thetaPC thetaPC commented Mar 17, 2026

Issue number: internal


What is the current behavior?

Component styles for ion-spinner are fragmented across multiple files (native and ionic). The md and ios theme uses the native styles. Developers were restricted to those themes and how those themes structured the logic and styles.

What is the new behavior?

  • Unified Style Architecture: Combined theme-specific styling into a single spinner.scss file that consumes CSS variables, ensuring a single source of truth for component logic.
  • Property First model: based the recipe on the properties
  • Updated TypeScript Interface: Changed the filename to spinner.interfaces.ts
  • Defined Theme Defaults: Added defaults that are being used per theme
  • Standardized Sizing: Introduced sizes to md and ios.
  • Updated Test Pages: Updated a couple of test pages to include more cases
  • Updated Tests: Updated tests to include more cases
  • Contextual Coloring: Implemented color: currentColor for slotted spinners within buttons. This ensures the spinner's visual weight matches the button's text/icon color dynamically across all interaction states (hover, active, disabled) without additional token mapping.

Does this introduce a breaking change?

  • Yes
  • No

This PR introduces a breaking change to how IonSpinner is styled. Existing manual CSS overrides targeting internal spinner structures or old token names will no longer work due to the shift to the new token hierarchy and a unified base SCSS file.

Migration Path:

  1. Token Updates: Update any custom theme configurations to match the new nested structure.

  2. CSS Overrides/Removals: Ensure selectors align with the new slotted element logic and variable names (e.g., --ion-spinner-color). CSS variables like --color have been removed in favor of the new variables.

--color should no longer be used. Setting the value, IonSpinner.color, within the tokens file should be used to change the color. If the color needs to be set per component, then --ion-spinner-color should be used.

  1. Theme classes: Remove any instances that target the theme classes: ion-spinner.md

  2. Spinner name class: The class have been updated to include the term name.

.spinner-lines, .spinner-circular, etc should be updated to .spinner-name-lines, .spinner-name-circular, etc.

Other information

Previews:

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ionic-framework Ready Ready Preview, Comment Mar 23, 2026 11:30pm

Request Review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ionic theme for spinner overwrites the medium since it's one of those components that differs to the set value of medium. I decided to not implement it since it's specific to the project. A workaround would be to set it:

ion-spinner {
  --ion-color-medium-bold: #626262;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only removed the word diff from the test file name to line up with the naming conventions of the other components.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only removed the word diff from the test file name to line up with the naming conventions of the other components.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only removed the word diff from the test file name to line up with the naming conventions of the other components.

@thetaPC thetaPC marked this pull request as ready for review March 18, 2026 20:46
@thetaPC thetaPC requested a review from a team as a code owner March 18, 2026 20:46
@thetaPC thetaPC requested a review from brandyscarney March 18, 2026 20:46
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was renamed, not sure why it's not showing as such.


- The properties `pull` and `push` have been deprecated and no longer work. A similar look can be achieved with the newly added property `order`.

<h4 id="version-9x-radio-group">Radio Group</h4>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was moved to the correct location. It was originally added right in the middle of the grid changes.

}

::slotted(ion-spinner) {
color: currentColor;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed because we are no longer using --color.

@thetaPC thetaPC requested review from ShaneK and brandyscarney March 23, 2026 18:23
Copy link
Copy Markdown
Member

@brandyscarney brandyscarney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good! Just a few comments.

Comment on lines -8 to -14
/**
* @prop --border-radius: Border radius of the chip
* @prop --color: Color of the chip
* @prop --focus-ring-color: Color of the focus ring
* @prop --focus-ring-style: Style of the focus ring
* @prop --focus-ring-width: Width of the focus ring
*/
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do we plan to document the new CSS variables? Are we going to add them here or somewhere else?

Copy link
Copy Markdown
Contributor Author

@thetaPC thetaPC Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this auto-generated? If not we should really find a way to do so lol.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it was painstakingly annoying 😭 I'll make a ticket for us to look into a way to generate these.

Copy link
Copy Markdown
Member

@ShaneK ShaneK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work!

@thetaPC thetaPC requested a review from brandyscarney March 24, 2026 14:20
Copy link
Copy Markdown
Member

@brandyscarney brandyscarney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job! 😄

@thetaPC thetaPC merged commit 1ce0e2d into ionic-modular Mar 24, 2026
92 of 94 checks passed
@thetaPC thetaPC deleted the FW-6860 branch March 24, 2026 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: angular @ionic/angular package package: core @ionic/core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants